#ifndef _COMMUNICATION_DEVICE_SENSOR_HEAD
#define _COMMUNICATION_DEVICE_SENSOR_HEAD

#include "communication-device.h"
#include "smart-device-manager.h"
#include <map>
/**
 * 传感器设备
 */
class CommunicationDeviceSensor : public CommunicationDevice
{
public:
    CommunicationDeviceSensor(SmartDeviceManager *manager);
    void communication(SmartDeviceNetProtocol &netProtocol, NetCommunication *netObj);
    void add(SmartDeviceNetProtocol &netProtocol, NetCommunication *netObj);
    void remove(SmartDeviceNetProtocol &netProtocol, NetCommunication *netObj);
    void query(SmartDeviceNetProtocol &netProtocol, NetCommunication *netObj);
    void replay(NetCommunication *netObj, const string &command, const string &errmsg = "", const string &data = "");

private:
    SmartDeviceManager *smartDeviceManager;
    typedef void (CommunicationDeviceSensor::*funcation_t)(SmartDeviceNetProtocol &, NetCommunication *);
    map<string, funcation_t> handle;
};
#endif